package com.qianbao.dao.xianwan;


import com.qianbao.domain.xianwan.XianWanEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface XianWanDao {


    /**
     * 插入一条订单信息
     * @param entity
     * @return
     */
    @Insert("INSERT INTO xianwan_device_order (adid,adname,appid,ordernum,dlevel,pagename," +
            "atype,deviceid,simid,appsign,merid,event,adicon,price,money,itime,keycode) " +
            "values(#{adid},#{adname},#{appid},#{ordernum},#{dlevel},#{pagename}," +
            "#{atype},#{deviceid},#{simid},#{appsign},#{merid},#{event},#{adicon}," +
            "#{price},#{money},#{itime},#{keycode})")
    public int saveDeviceOrder(XianWanEntity entity);


    /**
     * 查询数据库中是否存在这条订单
     * @param orderId
     * @return
     */
    @Select("select count(ordernum) from xianwan_device_order where ordernum = #{orderId}")
    public int findIsHaveOrder(String orderId);




}
